package org.akomantoso.core.data;

import java.io.IOException;

import org.akomantoso.core.io.Input;
import org.akomantoso.core.io.Output;

/**
 * The element FRBRManifestation is the metadata container of identifying properties related to the Manifestation level
 * according to the FRBR hierarchy.
 * 
 * <pre>
 * 	<xsd:element name="FRBRManifestation">
 * 		<xsd:complexType>
 * 			<xsd:complexContent>
 * 				<xsd:extension base="coreProperties">
 * 					<xsd:sequence>
 * 						<xsd:group ref="manifProperties"/>
 * 					</xsd:sequence>
 * 				</xsd:extension>
 * 			</xsd:complexContent>
 * 		</xsd:complexType>
 * 	</xsd:element>
 * </pre>
 * 
 * @author <a href="mailto:jacques.militello@gmail.com">Jacques Militello</a>
 * 
 * @since http://www.akomantoso.org/1.0
 * 
 */
public final class FRBRManifestation extends CoreProperty {

	public static final String ELEMENT = "FRBRManifestation";

	private FRBRformat _FRBRformat;
	/**
	 * @see org.akomantoso.core.data.CoreProperty#writeExternal(org.akomantoso.core.io.Output)
	 */
	@Override
	public <T extends Output> void writeExternal(T out) throws IOException {
		out.writeStart(ELEMENT);
		super.writeExternal(out);
		if (_FRBRformat != null) {
			_FRBRformat.writeExternal(out);
		}
		out.writeEnd();
	}

	/**
	 * @see org.akomantoso.core.data.CoreProperty#readExternal(org.akomantoso.core.io.Input)
	 */
	@Override
	public <T extends Input> void readExternal(T in) throws IOException {
		super.readExternal(in);
		if (FRBRformat.ELEMENT == in.getLocalName()) {
			_FRBRformat = new FRBRformat();
			_FRBRformat.readExternal(in);
			in.readNextStartElement();
		}
	}
}